<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>ring_type</title>
<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../../index.html" title="Chapter 1. Geometry">
<link rel="up" href="../core.html" title="Core Metafunctions">
<link rel="prev" href="radian.html" title="radian">
<link rel="next" href="tag.html" title="tag">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="radian.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../core.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="tag.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="geometry.reference.core.ring_type"></a><a class="link" href="ring_type.html" title="ring_type">ring_type</a>
</h4></div></div></div>
<p>
          <a class="indexterm" name="idm45246425346144"></a>
Metafunction defining <span class="bold"><strong>type</strong></span> as the ring_type
          of the specified geometry type.
        </p>
<h6>
<a name="geometry.reference.core.ring_type.h0"></a>
          <span class="phrase"><a name="geometry.reference.core.ring_type.description"></a></span><a class="link" href="ring_type.html#geometry.reference.core.ring_type.description">Description</a>
        </h6>
<p>
          A polygon contains one exterior ring and zero or more interior rings (holes).
          This metafunction retrieves the type of the rings. Exterior ring and each
          of the interior rings all have the same ring_type.
        </p>
<h6>
<a name="geometry.reference.core.ring_type.h1"></a>
          <span class="phrase"><a name="geometry.reference.core.ring_type.synopsis"></a></span><a class="link" href="ring_type.html#geometry.reference.core.ring_type.synopsis">Synopsis</a>
        </h6>
<p>
</p>
<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Geometry</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">ring_type</span>
<span class="special">{</span>
  <span class="comment">// ...</span>
<span class="special">};</span>
</pre>
<p>
        </p>
<h6>
<a name="geometry.reference.core.ring_type.h2"></a>
          <span class="phrase"><a name="geometry.reference.core.ring_type.template_parameter_s_"></a></span><a class="link" href="ring_type.html#geometry.reference.core.ring_type.template_parameter_s_">Template
          parameter(s)</a>
        </h6>
<div class="informaltable"><table class="table">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
                  <p>
                    Parameter
                  </p>
                </th>
<th>
                  <p>
                    Description
                  </p>
                </th>
</tr></thead>
<tbody><tr>
<td>
                  <p>
                    typename Geometry
                  </p>
                </td>
<td>
                  <p>
                    A type fullfilling the Ring, Polygon or MultiPolygon concept.
                  </p>
                </td>
</tr></tbody>
</table></div>
<h6>
<a name="geometry.reference.core.ring_type.h3"></a>
          <span class="phrase"><a name="geometry.reference.core.ring_type.header"></a></span><a class="link" href="ring_type.html#geometry.reference.core.ring_type.header">Header</a>
        </h6>
<p>
          Either
        </p>
<p>
          <code class="computeroutput"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
        </p>
<p>
          Or
        </p>
<p>
          <code class="computeroutput"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">/</span><span class="identifier">core</span><span class="special">/</span><span class="identifier">ring_type</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
        </p>
<h6>
<a name="geometry.reference.core.ring_type.h4"></a>
          <span class="phrase"><a name="geometry.reference.core.ring_type.complexity"></a></span><a class="link" href="ring_type.html#geometry.reference.core.ring_type.complexity">Complexity</a>
        </h6>
<p>
          Compile time
        </p>
<h6>
<a name="geometry.reference.core.ring_type.h5"></a>
          <span class="phrase"><a name="geometry.reference.core.ring_type.example"></a></span><a class="link" href="ring_type.html#geometry.reference.core.ring_type.example">Example</a>
        </h6>
<p>
          Shows how to use the ring_type metafunction, as well as interior_type
        </p>
<p>
</p>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">iostream</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">typeinfo</span><span class="special">&gt;</span>

<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">/</span><span class="identifier">geometries</span><span class="special">/</span><span class="identifier">polygon</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">/</span><span class="identifier">geometries</span><span class="special">/</span><span class="identifier">point_xy</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>

<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
<span class="special">{</span>
    <span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">model</span><span class="special">::</span><span class="identifier">d2</span><span class="special">::</span><span class="identifier">point_xy</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;</span> <span class="identifier">point</span><span class="special">;</span>
    <span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">model</span><span class="special">::</span><span class="identifier">polygon</span><span class="special">&lt;</span><span class="identifier">point</span><span class="special">&gt;</span> <span class="identifier">polygon</span><span class="special">;</span>

    <span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">ring_type</span><span class="special">&lt;</span><span class="identifier">polygon</span><span class="special">&gt;::</span><span class="identifier">type</span> <span class="identifier">ring_type</span><span class="special">;</span>
    <span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">interior_type</span><span class="special">&lt;</span><span class="identifier">polygon</span><span class="special">&gt;::</span><span class="identifier">type</span> <span class="identifier">int_type</span><span class="special">;</span>

    <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="keyword">typeid</span><span class="special">(</span><span class="identifier">ring_type</span><span class="special">).</span><span class="identifier">name</span><span class="special">()</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
    <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="keyword">typeid</span><span class="special">(</span><span class="identifier">int_type</span><span class="special">).</span><span class="identifier">name</span><span class="special">()</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>

    <span class="comment">// So int_type defines a collection of rings,</span>
    <span class="comment">// which is a Boost.Range compatible range</span>
    <span class="comment">// The type of an element of the collection is the very same ring type again.</span>
    <span class="comment">// We show that.</span>
    <span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">range_value</span><span class="special">&lt;</span><span class="identifier">int_type</span><span class="special">&gt;::</span><span class="identifier">type</span> <span class="identifier">int_ring_type</span><span class="special">;</span>

    <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span>
        <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">boolalpha</span>
        <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">is_same</span><span class="special">&lt;</span><span class="identifier">ring_type</span><span class="special">,</span> <span class="identifier">int_ring_type</span><span class="special">&gt;::</span><span class="identifier">value</span>
        <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>

    <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
<span class="special">}</span>
</pre>
<p>
        </p>
<p>
          Output (using gcc):
        </p>
<pre class="programlisting">N5boost8geometry5model4ringINS1_2d28point_xyIdNS0_2cs9cartesianEEELb1ELb1ESt6vectorSaEE
St6vectorIN5boost8geometry5model4ringINS2_2d28point_xyIdNS1_2cs9cartesianEEELb1ELb1ES_SaEESaIS9_EE
true
</pre>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2009-2021 Barend Gehrels,
      Bruno Lalande, Mateusz Loskot, Adam Wulkiewicz, Oracle and/or its affiliates<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="radian.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../core.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="tag.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
